/**
 * 
 */
package com.gnizr.db.dao.comment;

import java.io.Serializable;
import java.util.List;

import com.gnizr.db.dao.*;
/**
 * @author Jason
 *
 */
public interface CommentDao extends Serializable {
	
	public static final int SORT_BY_CREATED_ON = 1;
	public static final int SORT_BY_LAST_UPDATED = 2;
	public static final int DESCENDING = 1;
	public static final int ASCENDING = 2;
	
	public int createComment(Comment com);
	public boolean deleteComment(int id);
	
	public List<Comment> findComment(User user, Bookmark bm);
	public Comment getComment(int id);
	
	/**
	 * Returns the total number of comments that reference
	 * a particular <code>Bookmark</code>.
	 * 
	 * @param link a <code>Bookmark</code> object and call to <code>bookmark.getId()</code>
	 * returns a valid id value. 
	 * @return total number of comments that refers a common <code>Bookmark</code>
	 */
	public int getCommentCount(Bookmark bookmark);
	
	/**
	 * Returns a list of <code>Comments</code> objects for a given <code>Bookmark</code> with paging support.
	 * The paging begins at the <code>offset</code> and retuns no more than <code>count</code> number 
	 * of <code>Comments</code> objects. 
	 * 
	 * @param bookmark a <code>Bookmark</code> object and call to <code>bookmark.getId()</code> returns
	 * a valid id value.
	 * @param offset starting index of the paging
	 * @param count the maximum number of matching objects
	 * @return
	 */
	public DaoResult<Comment> pageComments(Bookmark bookmark, int offset, int count);
	
	/**
	 * Returns a list of <code>Comments</code> objects for a given <code>User</code> with paging support.
	 * The paging begins at the <code>offset</code> and retuns no more than <code>count</code> number 
	 * of <code>Comment</code> objects.
	 * 
	 * @param user a <code>User</code> object and call to <code>user.getId()</code> returns
	 * a valid id value.
	 * @param offset starting index of the paging
	 * @param count the maximum number of matching objects
	 * @return
	 */
	public DaoResult<Comment> pageComments(User user, int offset, int count);
	
	public boolean updateComment(Comment com);	
}
